<?php
require_once("AsteriskManager/config.php");
include("AsteriskManager/sesvars.php");
if(isset($_SESSION['QSTATS']['hideloggedoff'])) {
    $ocultar=$_SESSION['QSTATS']['hideloggedoff'];
} else {
    $ocultar="false";
}
 
          $user		= $_SESSION['USERID'];
          $res = mysql_fetch_assoc(mysql_query("	SELECT 	crystal_users.group_id
									          		FROM    crystal_users
									          		WHERE  	crystal_users.id = $user
									          		"));
          
			if($res[group_id] != 2 && $res[group_id] != 3){
				$tab_checker = 'style="display:none"';
				$button_filter =  '$("#move-dialog").hide();';
				
			}else{
				$button_filter ="";
				$tab_checker = "";
			}
	          ?>
<head>
<style type="text/css">
.download {

	
	background-color:#4997ab;
	border-radius:5px;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:arial;
	font-size:14px;
	border:0px;
	text-decoration:none;
	text-overflow: ellipsis;
	
}
#logout1{
	float: right;
}
.download1 {

	background-color:#ce8a14;
	border-radius:5px;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:arial;
	font-size:14px;
	border:0px;
	text-decoration:none;
	text-overflow: ellipsis;
	
}
.download2 {

	background-color:#d35454;
	border-radius:5px;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:arial;
	font-size:14px;
	border:0px;
	text-decoration:none;
	text-overflow: ellipsis;
	
}
.download4 {

	
	background-color:#71b251;
	border-radius:5px;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:arial;
	font-size:14px;
	text-decoration:none;
	border:0px;
	text-overflow: ellipsis;
}
.download3 {

	
	background-color:#a07ab3;
	border-radius:5px;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:arial;
	font-size:14px;
	border:0px;
	text-decoration:none;
	text-overflow: ellipsis;
	
}

.download5 {

	
	background-color:#4980AF;
	border-radius:5px;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:arial;
	font-size:14px;
	border:0px;
	text-decoration:none;
	text-overflow: ellipsis;
	
}
.download6 {

	background-color:#CE5F14;
	border-radius:5px;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:arial;
	font-size:14px;
	border:0px;
	text-decoration:none;
	text-overflow: ellipsis;
	
}
.myButton:hover {
	background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #408c99), color-stop(1, #599bb3));
	background:-moz-linear-gradient(top, #408c99 5%, #599bb3 100%);
	background:-webkit-linear-gradient(top, #408c99 5%, #599bb3 100%);
	background:-o-linear-gradient(top, #408c99 5%, #599bb3 100%);
	background:-ms-linear-gradient(top, #408c99 5%, #599bb3 100%);
	background:linear-gradient(to bottom, #408c99 5%, #599bb3 100%);
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#408c99', endColorstr='#599bb3',GradientType=0);
	background-color:#408c99;
}
.myButton:active {
	position:relative;
	top:1px;
}
.hidden{
	display: none;
}

#num_block, #move-dialog {
    float: left;
}

#cancel-dialog, #move-dialog, #save-dialog  {
    float: right;
}

.ui-dialog-buttonset{
	width: 100% !important;
}

#box-table-b
{
	font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
	font-size: 12px;
	text-align: center;
	border-collapse: collapse;
	border-top: 7px solid #9baff1;
	border-bottom: 7px solid #9baff1;
}
#box-table-b th
{
	font-size: 13px;
	font-weight: normal;
	padding: 8px;
	background: #e8edff;
	border-right: 1px solid #9baff1;
	border-left: 1px solid #9baff1;
	color: #039;
}
#box-table-b td
{
	padding: 8px;
	background: #e8edff; 
	border-right: 1px solid #aabcfe;
	border-left: 1px solid #aabcfe;
	color: #669;
}
</style>
<script type="text/javascript">
	    var logout      =true;      
		var aJaxURL		= "server-side/call/incomming.action.php";		//server side folder url
		var aJaxURL1	= "server-side/call/incomming.action1.php";
		var aJaxURL2	= "server-side/call/incomming.action2.php";
		var aJaxURL3	= "server-side/call/incomming.action3.php";
		var aJaxURL4	= "server-side/call/incomming.action4.php";
		var aJaxURL5	= "server-side/call/incomming.action5.php";
		var aJaxURL6	= "server-side/call/incomming.action6.php";
		var seoyURL		= "server-side/seoy/seoy.action.php";
		var upJaxURL	= "server-side/upload/file.action.php";	
		var wsdl_url    = "server-side/wsld/wsdl.action.php";
		var asterisk_url    = "server-side/asterisk/asterisk.action.php";
		var tName	= "example";										//table name
		var fName	= "add-edit-form";
		var tbName		= "tabs";										//form name
		var file_name = '';
		var rand_file = '';
		var tab      = 0;
		var fillter ='';
		var fillter_all='';

		$(document).ready(function () {

			runAjax();
			GetTabs(tbName); 
			GetTable0();
			
		});
		$(document).on("tabsactivate", "#tabs", function() {
        	tab = GetSelectedTab(tbName);
        	if (tab == 0) {
        		GetTable0();
         	}else if(tab == 1){
            	GetTable1();
			}
         	else if(tab == 2){
          		GetTable2();
          	}
        	else if(tab == 3){
              	GetTable3();
            }
        	else if(tab == 4){
              	GetTable4();
            }
        	else if(tab == 5){
            	GetTable5();
            }
        	else{
            	GetTable6();
            }
        });
		
		function GetTable0() {
            LoadTable();
            GetButtons("add_button", "","refresh");			
			SetEvents("add_button", "", "refresh", "example", fName, aJaxURL);			
        }
        function GetTable1() {
             LoadTable1();
             GetButtons("", "","refresh_button","search_button_all");
             SetEvents("", "", "refresh_button", "example1", fName, aJaxURL1);
             GetDateTimes("search_start_my");
             GetDateTimes("search_end_my");
         }
         function GetTable2() {
             LoadTable2();
             SetEvents("", "", "", "example2", fName, aJaxURL2);
         }
		 function GetTable3() {
             LoadTable3();
             SetEvents("", "", "", "example3", fName, aJaxURL3);
         }
		 function GetTable4() {
             LoadTable4();
             GetButtons("", "","refresh_button1", "search_button_all1");
             SetEvents("", "", "refresh_button1", "example4", fName, aJaxURL4);
             GetDateTimes("search_start_my1");
             GetDateTimes("search_end_my1");
         }
		 function GetTable5() {
			 LoadTable5();
             GetButtons("", "delete_button","");
             SetEvents("", "delete_button", "", "example555", fName, aJaxURL5);
            
         }
		 function GetTable6() {
			 LoadTable6();
             GetButtons("", "","refresh_button2", "search_button_all2");
             SetEvents("", "", "refresh_button2", "example6", fName, aJaxURL6);
             GetDateTimes("search_start_my2");
             GetDateTimes("search_end_my2");
            
         }
         

		 function LoadTable(){
				/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
				GetDataTable("example", aJaxURL, "get_list", 13, "fillter=" + fillter, 0, "", 2, "desc");
			}
		function LoadTable1(){
			var start	= $("#search_start_my").val();
	    	var end		= $("#search_end_my").val();
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
	    	GetDataTable("example1", aJaxURL1, "get_list", 13, "start1=" + start + "&end1=" + end + "&fillter_all=" + fillter_all, 0, "", 2, "desc");
			
			}
		function LoadTable2(){
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable("example2", aJaxURL2, "get_list", 13, "", 0, "", 1, "desc");
			}
		function LoadTable3(){
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable("example3", aJaxURL3, "get_list", 13, "", 0, "", 1, "desc");
			}
		function LoadTable4(){
			var start	= $("#search_start_my1").val();
	    	var end		= $("#search_end_my1").val();
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
	    	GetDataTable("example4", aJaxURL4, "get_list", 13, "start=" + start + "&end=" + end, 0, "", 1, "desc");
			}
		function LoadTable5(){
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable("example555", aJaxURL5, "get_list", 13, "", 0, "", 1, "desc");
			}
		function LoadTable6(){
			var start	= $("#search_start_my2").val();
	    	var end		= $("#search_end_my2").val();
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable("example6", aJaxURL6, "get_list", 13, "start=" + start + "&end=" + end, 0, "", 1, "desc");
			}

		
		$(document).on("click", "#search_button_all", function () {
	    	LoadTable1();
	    });
	    
	    $(document).on("click", "#search_button_all1", function () {
	    	LoadTable4();
	    });
	    
	    $(document).on("click", "#search_button_all2", function () {
	    	LoadTable6();
	    });



	    
	    $(document).on("click", "#filter_dam_shem", function () {
	    	fillter	= $("#filter_dam_shem").val();
	    	LoadTable();
	    });
	    $(document).on("click", "#filter_transf_shem", function () {
	    	fillter	= $("#filter_transf_shem").val();
	    	LoadTable();
	    });
	    $(document).on("click", "#filter_dam_gam", function () {
	    	fillter	= $("#filter_dam_gam").val();
	    	LoadTable();
	    });
	    $(document).on("click", "#filter_transf_gam", function () {
	    	fillter	= $("#filter_transf_gam").val();
	    	LoadTable();
	    });
	    $(document).on("click", "#filter_unansver", function () {
	    	fillter	= $("#filter_unansver").val();
	    	
	    	LoadTable();
	    });
	    $(document).on("click", "#filter_dau_gam", function () {
	    	fillter	= $("#filter_dau_gam").val();
	    	LoadTable();
	    });
	    $(document).on("click", "#filter_dau_shem", function () {
	    	fillter	= $("#filter_dau_shem").val();
	    	LoadTable();
	    });


    	$(document).on("click", "#filter_dam_shem1", function () {
	 	    fillter_all	= $("#filter_dam_shem1").val();
		 	LoadTable1();
	 	});
    	$(document).on("click", "#filter_transf_shem1", function () {
	 	    fillter_all	= $("#filter_transf_shem1").val();
		 	LoadTable1();
	 	});
 	    $(document).on("click", "#filter_dam_gam1", function () {
 	    	fillter_all	= $("#filter_dam_gam1").val();
 	    	LoadTable1();
 	   	});
  	   $(document).on("click", "#filter_transf_gam1", function () {
	    	fillter_all	= $("#filter_transf_gam1").val();
	    	LoadTable1();
	   	});
	 	$(document).on("click", "#filter_unansver1", function () {
	 		fillter_all	= $("#filter_unansver1").val();
	 		LoadTable1();
	 	});
	 	$(document).on("click", "#filter_dau_gam1", function () {
	 		fillter_all	= $("#filter_dau_gam1").val();
	 		LoadTable1();
	 	});
	 	$(document).on("click", "#filter_dau_shem1", function () {
	 		fillter_all	= $("#filter_dau_shem1").val();
	 		LoadTable1();
	    });

	    
	 	$(document).on("click", "#num_block", function LoadDialog2(){
			var buttons = {
			        "num_block_locked": {
			            text: "დაბლოკვა",
			            id: "num_block_locked",
			         }
					
			};
			GetDialog("numlock_dialog", 280, "auto", buttons);
			$("#numlock_dialog").html('<span>კომენტარი</span><textarea style="width: 245px; height: 80px; resize: none;" id="block_comment" class="idle"></textarea>');
		});
	    
		function LoadDialog(){
			
			var buttons = {	
					"num_block": {
			            text: "ნომრის დაბლოკვა",
			            id: "num_block"
			        }, 
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			            	$(this).dialog("close");
			            }
			        },
					"done": {
			            text: "გადატანა",
			            id: "move-dialog"
			        }, 
			        "save": {
			            text: "შენახვა",
			            id: "save-dialog"
			        } 
		        	
			    };
		    

			/* Dialog Form Selector Name, Buttons Array */
			GetDialog(fName, 1060, "auto",buttons );
			$("#call_content").autocomplete("server-side/seoy/seoy_textarea.action.php", {
				width: 500,
				multiple: true,
				matchContains: true
			});
			var id = $("#incomming_id").val();
			var cat_id = $("#category_parent_id").val();

			if(id != '' && cat_id == 407){
				$("#additional").removeClass('hidden');
			}

			GetDateTimes("problem_date");
			 $(document).on("click", "#button_calls", function () {
				 LoadDialogCalls();
				 $('#refresh-dialog').click(); });
			$( ".calls" ).button({
			      icons: {
			        primary: " ui-icon-contact"
			      }
			});
			<?php echo($button_filter);?>
		    if (tab==5){
			    
		    	 $("#move-dialog").hide();
			    }
		}

		$(document).on("click", ".download1", function () {
			var str = 1;
			var link = ($(this).attr("str"));
			link = 'http://91.233.15.136:8181/' + link;
			var btn = {
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog_audio("audio_dialog", "auto", "auto",btn);
			
			$("#audio_dialog").html('<audio controls autoplay style="width:500px;"><source src="'+link+'" type="audio/wav"> Your browser does not support the audio element.</audio>');
            $(".download1").css( "background","#F99B03" );
            $(this).css( "background","#33dd33" );
           
        });
		$(document).on("click", ".download3", function () {
			var str = 1;
			var link = ($(this).attr("str"));
			link = 'http://91.233.15.136:8181/' + link;
			var btn = {
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog_audio("audio_dialog", "auto", "auto",btn);
			
			$("#audio_dialog").html('<audio controls autoplay style="width:500px;"><source src="'+link+'" type="audio/wav"> Your browser does not support the audio element.</audio>');
            $(".download1").css( "background","#F99B03" );
            $(this).css( "background","#33dd33" );
           
        });
		$(document).on("click", ".download6", function () {
			var str = 1;
			var link = ($(this).attr("str"));
			link = 'http://91.233.15.136:8181/' + link;
			var btn = {
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog_audio("audio_dialog", "auto", "auto",btn);
			
			$("#audio_dialog").html('<audio controls autoplay style="width:500px;"><source src="'+link+'" type="audio/wav"> Your browser does not support the audio element.</audio>');
            $(".download1").css( "background","#F99B03" );
            $(this).css( "background","#33dd33" );
           
        });
		$(document).on("click", ".download5", function () {
			var str = 1;
			var link = ($(this).attr("str"));
			link = 'http://91.233.15.136:8181/' + link;
			var btn = {
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog_audio("audio_dialog", "auto", "auto",btn);
			
			$("#audio_dialog").html('<audio controls autoplay style="width:500px;"><source src="'+link+'" type="audio/wav"> Your browser does not support the audio element.</audio>');
            $(".download1").css( "background","#F99B03" );
            $(this).css( "background","#33dd33" );
           
        });
		$(document).on("click", ".download", function () {
			var str = 1;
			var link = ($(this).attr("str"));
			link = 'http://91.233.15.136:8181/' + link;
			var btn = {
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog_audio("audio_dialog", "auto", "auto",btn);
		//	alert('hfgj');
			$("#audio_dialog").html('<audio controls autoplay style="width:500px;"><source src="'+link+'" type="audio/wav"> Your browser does not support the audio element.</audio>');
            $(".download").css( "background","#408c99" );
            $(this).css( "background","#FF5555" );
           
        });
		$(document).on("click", ".download2", function () {
			var str = 1;
			var link = ($(this).attr("str"));
			link = 'http://91.233.15.136:8181/' + link;
			var btn = {
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog_audio("audio_dialog", "auto", "auto",btn);
		//	alert('hfgj');
			$("#audio_dialog").html('<audio controls autoplay style="width:500px;"><source src="'+link+'" type="audio/wav"> Your browser does not support the audio element.</audio>');
            $(".download").css( "background","#408c99" );
            $(this).css( "background","#FF5555" );
           
        });
		$(document).on("click", ".download4", function () {
			var str = 1;
			var link = ($(this).attr("str"));
			link = 'http://91.233.15.136:8181/' + link;
			var btn = {
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			                $(this).dialog("close");
			            }
			        }
			    };
			GetDialog_audio("audio_dialog", "auto", "auto",btn);
		//	alert('hfgj');
			$("#audio_dialog").html('<audio controls autoplay style="width:500px;"><source src="'+link+'" type="audio/wav"> Your browser does not support the audio element.</audio>');
            $(".download").css( "background","#408c99" );
            $(this).css( "background","#FF5555" );
           
        });

// 		 $(button).on("click", ".download", function (){
//         	  $(this).css( "background","#FF5555" );
//          });
		
		function CloseDialog(){
			$("#" + fName).dialog("close");
		}

	    // Add - Save
	    $(document).on("click", "#save-dialog", function () {
	    	$('#save-dialog').attr('disabled','disabled');
		    param 			= new Object();

		    param.act						= "save_incomming";

	    	param.id						= $("#id").val();
	    	param.phone						= $("#phone").val();
	    	param.call_date					= $("#call_date").val();
	    	param.pin						= $("#site_user_pin").val();
	    	param.hidden_user				= $("#hidden_user").val();

	    	param.controler_id				= $("#controler_id").val();
	    	param.task_phone				= $("#task_phone").val();
	    	param.connect					= $('input[name=check_transfer]:checked').val();
	    	param.call_type_id				= $("#call_type_id").val();
	    	param.category_id				= $("#category_id").val();
	    	param.category_parent_id		= $("#category_parent_id").val();
	    	param.problem_date				= $("#problem_date").val();
	    	param.call_status_id			= $("#call_status_id").val();
	    	param.call_content				= $("#call_content").val();
	    	param.persons_id				= $("#persons_id").val();
	    	param.comment					= $("#comment").val();
	    	param.money						= $("#money").val();
	    	param.task_department_id		= $("#task_department_id").val();
	    	param.task_type_id				= $("#task_type_id").val();
	    	param.priority_id				= $("#priority_id").val();
	    	param.problem_id				= $("#problem_id").val();
	    	param.pay_type_id				= $("#pay_type_id").val();
	    	param.bank_id					= $("#bank_id").val();
	    	param.bank_object_id			= $("#bank_object_id").val();
	    	param.card_type_id				= $("#card_type_id").val();
	    	param.card_type1_id				= $("#card_type1_id").val();
	    	param.pay_aparat_id				= $("#pay_aparat_id").val();
	    	param.object_id					= $("#object_id").val();
	    	param.personal_pin				= $("#personal_pin").val();
	    	param.personal_id				= $("#personal_id").val();
	    	param.source_id					= $("#source_id").val();
	    	param.rand_file					= rand_file;
	    	param.file_name					= file_name;
	    	param.hidden_inc				= $("#hidden_inc").val();
	    	
			if(param.req_phone == ""){
				alert("შეავსეთ ტელეფონის ნომერი!");
			}else {
			    $.ajax({
			        url: aJaxURL,
				    data: param,
			        success: function(data) {
						if(typeof(data.error) != 'undefined'){
							if(data.error != ''){
								alert(data.error);
								$("#save-dialog").attr('disabled', false); 
								
							}else{
								 LoadTable();
								 LoadTable1();
								 LoadTable2();
								 LoadTable3();
								 LoadTable4();
								 LoadTable5();
								 LoadTable6();
				        		CloseDialog();
				        		//console.log(data.error);
							}
						}
				    }
			    });
			}
		});


	    $(document).on("click", "#move-dialog", function () {
		    param 			= new Object();

		    param.act						= "move_incomming";

	    	param.id						= $("#id").val();
	    	if(param.req_phone == ""){
				alert("შეავსეთ ტელეფონის ნომერი!");
			}else {
			    $.ajax({
			        url: aJaxURL,
				    data: param,
			        success: function(data) {
						if(typeof(data.error) != 'undefined'){
							if(data.error != ''){
								alert(data.error);
							}else{
								 LoadTable();
								 LoadTable1();
								 LoadTable2();
								 LoadTable3();
								 LoadTable4();
								 LoadTable5();
				        		CloseDialog();
				        		console.log(data.error);
							}
						}
				    }
			    });
			}
		});
	    
	    $(document).on("click", "#refresh", function () {
	    	fillter='';
	    	LoadTable(fillter);
	    });    
	    $(document).on("click", "#refresh_button", function () {
	    	fillter_all='';
			LoadTable1();
				
		});

 $(document).on("click", "#refresh_button1", function () {
	    	
	    	param 				= new Object();
	    	param.act			= "refresh";
	    	
	    	$.ajax({
		        url: aJaxURL4,
			    data: param,
		        success: function(data) {
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							alert(data.error);
						}else{
							 $("#search_end_my1").val(data.date);
							 LoadTable4();
						}
					}
			    }
		    });
		});
 $(document).on("click", "#refresh_button2", function () {
	 	
	 	param 				= new Object();
	 	param.act			= "refresh";
	 	
	 	$.ajax({
		        url: aJaxURL6,
			    data: param,
		        success: function(data) {
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							alert(data.error);
						}else{
							 $("#search_end_my2").val(data.date);
							 LoadTable6();
						}
					}
			    }
		    });
		});

	
	    $(document).on("click", "#num_block_locked", function () {
	    	

	    	
		    param 				= new Object();
			param.phone			= $("#phone").val();
            param.block_comment = $("#block_comment").val();
		 	
            param.act		= "black_list_add";
			if(param.phone == ""){
				alert("შეავსეთ ტელეფონის ნომერი!");
			}else {
				$.ajax({
			        url: asterisk_url,
			        data: param,
				  success: function(data) {
					  if(typeof(data.error) != 'undefined'){
							if(data.error != ''){
								alert(data.error);
							}else{
								 LoadTable();
								 $("#numlock_dialog").dialog("close");
								
							}
						}
					}
			    });
			    $.ajax({
			        url: aJaxURL,
				    data: param,
			        success: function(data) {
						if(typeof(data.error) != 'undefined'){
							if(data.error != ''){
								alert(data.error);
							}else{
								 LoadTable();
								 $("#numlock_dialog").dialog("close");
								
							}
						}
				    }
			    });
			}
		});
	    function run(number){

	    	param 			= new Object();
		 	param.act		= "get_add_page";
		 	param.number	= number;

	    	$.ajax({
		        url: aJaxURL,
			    data: param,
		        success: function(data) {
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							alert(data.error);
						}else{
							$("#add-edit-form").html(data.page);
							LoadDialog();
						}
					}
			    }
		    });
		    }

	    $(document).on("click", "#download", function () {
	    	var download_file	= $(this).val();
	    	var download_name 	= $('#download_name').val();
	    	SaveToDisk(download_file, download_name);
	    });

	    function SaveToDisk(fileURL, fileName) {
	        // for non-IE
	        if (!window.ActiveXObject) {
	            var save = document.createElement('a');
	            save.href = fileURL;
	            save.target = '_blank';
	            save.download = fileName || 'unknown';

	            var event = document.createEvent('Event');
	            event.initEvent('click', true, true);
	            save.dispatchEvent(event);
	            (window.URL || window.webkitURL).revokeObjectURL(save.href);
	        }
		     // for IE
	        else if ( !! window.ActiveXObject && document.execCommand)     {
	            var _window = window.open(fileURL, "_blank");
	            _window.document.close();
	            _window.document.execCommand('SaveAs', true, fileName || fileURL)
	            _window.close();
	        }
	    } 
	    
	    $(document).on("click", "#delete", function () {
	    	var delete_id	= $(this).val();
	    	var r = confirm("გსურთ წაშალოთ?");
	    	if (r == true) {
	    		$.ajax({
			        url: aJaxURL,
				    data: {
						act: "delete_file",
						delete_id: delete_id,
						edit_id: $("#id").val(),
					},
			        success: function(data) {
				        $("#file_div").html(data.page);
				    }
	    		
			    });
	    	}	
		});
		
	    $(document).on("click", "#choose_button", function () {
		    $("#choose_file").click();
		});
		
	    $(document).on("change", "#choose_file", function () {
	    	var file		= $(this).val();	    
	    	var files 		= this.files[0];
		    var name		= uniqid();
		    var path		= "../../media/uploads/file/";
		    
		    var ext = file.split('.').pop().toLowerCase();
	        if($.inArray(ext, ['pdf','png','xls','xlsx','jpg']) == -1) { //echeck file type
	        	alert('This is not an allowed file type.');
                this.value = '';
	        }else{
	        	file_name = files.name;
	        	rand_file = name + "." + ext;
	        	$.ajaxFileUpload({
	    			url: upJaxURL,
	    			secureuri: false,
	    			fileElementId: "choose_file",
	    			dataType: 'json',
	    			data:{
						act: "upload_file",
						path: path,
						file_name: name,
						type: ext
					},
	    			success: function (data, status){
	    				if(typeof(data.error) != 'undefined'){
    						if(data.error != ''){
    							alert(data.error);
    						}
    					}
    							
	    				$.ajax({
					        url: aJaxURL,
						    data: {
								act: "up_now",
								rand_file: rand_file,
					    		file_name: file_name,
								edit_id: $("#id").val(),

							},
					        success: function(data) {
						        $("#file_div").html(data.page);
						    }
					    });	   					    				
    				},
    				error: function (data, status, e)
    				{
    					alert(e);
    				}    				
    			});
	        }
		});
    $(document).on("click", "#logout1", function () {
		            	
	window.location.href="index.php?act=logout";
 });
    $(document).on("click", "#login", function () {
    	logout=false;
    	$("#logout").dialog("close");
    	
    	
     });
	    function runAjax() {
            $.ajax({
            	async: true,
            	dataType: "html",
		        url: 'AsteriskManager/liveState.php',
			    data: 'sesvar=hideloggedoff&value=true',
		        success: function(data) {
							$("#jq").html(data);
			    }
            }).done(function(data) {
                setTimeout(runAjax, 1000);
            });
            $.ajax({
		        url: aJaxURL,
			    data: {
					act: "logout",
				},
		        success: function(data) {
			        if(logout==true) {
			       
			       if(data.logout==1){			    	   
				   			buttons = {	
				   				 "logout1": {
				   			            text: "არა",
				   			            id: "logout1"
				   			       }, 
				   					"login": {
				   			            text: "დიახ",
				   			            id: "login"
				   			       } 
					   			};
				   		    
    						if(data.time==0){
        						logout=true; window.location.href="index.php?act=logout";
        					}
				   			/* Dialog Form Selector Name, Buttons Array */
   						 $("#logout").html('თქვენი სამუშაო გრაფიკით განსაზღვრული დრო ამოიწურა!გსურთ სისტემაში დარჩენა?<br> <div style="margin: 5px 0px 0 146px; padding: 5px 10px; display: inline-block;">დარჩენილი დრო </div> <div style="margin: 5px auto; padding: 5px 10px; border: solid 1px; display: inline-block;">'+data.time+'</div><div style="margin: 5px auto; padding: 5px 10px; display: inline-block;">წმ</div>');
				   			GetDialog("logout", "auto", "auto",buttons);
				   			
			    	}else 
			    		{
			    		//$("#logout").dialog("close");
				    	}
			    	
			    	}
		        }
				 
		    });	   				
        }

	    $(document).on("click", ".number", function () {
	    	var number = $(this).attr("number");
	    	if(number != ""){
	    		run(number);
	    		console.log(number);
		    }
	    });

	    $(document).on("click", ".insert", function () {
	    	var phone = $(this).attr("number");
	    	console.log(phone);
	    	if(phone != ""){
	    		$('#phone').val(phone);
		    }
	    });

	    $(document).on("change", "#task_type_id",function(){
		    var task_type = $("#task_type_id").val();

			if(task_type == 1){
				$("#task_department_id").val(37);
			}
		    
	    });
	   

    	$(document).on("change", "#category_parent_id",function(){
     	 	param 			= new Object();
 		 	param.act		= "sub_category";
 		 	param.cat_id   	= this.value;
 	    	$.ajax({
 		        url: aJaxURL,
 			    data: param,
 		        success: function(data) {
 					if(typeof(data.error) != 'undefined'){
 						if(data.error != ''){
 							alert(data.error);
 						}else{
 							$("#category_id").html(data.cat);
 						}
 					}
 			    }
 		    });

			if(this.value == 407){
				$("#additional").removeClass('hidden');
			}else{
				$("#additional").addClass('hidden');
			}
        });

    	$(document).on("change", "#category_id",function(){
			if(this.value == 423){
				$(".friend").removeClass('hidden');
			}else{
				$(".friend").addClass('hidden');
			}
        });

	    $(document).on("click", "#refresh-dialog", function () {
    	 	param 			= new Object();
		 	param.act		= "get_calls";

	    	$.ajax({
		        url: aJaxURL,
			    data: param,
		        success: function(data) {
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							alert(data.error);
						}else{
							$("#last_calls").html(data.calls);
							$( ".insert" ).button({
							      icons: {
							        primary: "ui-icon-plus"
							      }
							});
						}
					}
			    }
		    });

	    });

	    $(document).on("click", "#search", function () {
	    	param 			= new Object();
	    	param.act		= 'pin';
		 	param.pin		= $("#personal_pin").val();
		 	param.pid		= $("#personal_id").val();
		 	
		 	$.ajax({
		        url: wsdl_url,
		        data: param,
			  success: function(data) {
					link = 'http://192.168.215.30/pages/customredirect.aspx?RequestId=' + data.page;

				            window.open(link, 'chatwindow', "width=1250,height=800,resizable=yes,scrollbars=yes,status=yes");

				            
						
					
			    }
		    });

	    });
	   
	    $(document).on("click", "#search_phone", function () {
	    	param 			= new Object();
	    	
	    	param.act		= 'phone';
		 	param.phone		= $("#phone").val();
		 	$.ajax({
		        url: wsdl_url,
		        data: param,
			  success: function(data) {
				  if(data.status=='true'){
						link = 'http://192.168.215.30/pages/customredirect.aspx?RequestId=' + data.page;
						window.open(link, 'chatwindow', "width=1250,height=800,resizable=yes,scrollbars=yes,status=yes");
					}else{
						alert('მომხმარებელი ასეთი ნომრით ვერ მოიძებნა');
						}       
				}
		    });

	    });
//
	    $(document).on("change", "#pay_type_id",function(){
    		var a1 = $("#category_parent_id").val();
	 		var a2 = $("#category_id").val();
	 		var a3 = $("#pay_type_id").val();

	 		

	 		if( a1 == 407 && a2 == 421 && a3 == 11 ){
	 			$( "#bank_id" ).addClass( "hidden_important" );
	 			$( "#card_type_id" ).addClass( "hidden_important" );
 				$( "#bank_id_label" ).addClass( "hidden_important" );
	 			$( "#bank_label" ).addClass( "hidden_important" );
	 			$( "#card_label" ).addClass( "hidden_important" );
 				
	 		}else{
	 			$( "#bank_id" ).removeClass( "hidden_important" );
	 			$( "#card_type_id" ).removeClass( "hidden_important" );
	 			$( "#bank_id_label" ).removeClass( "hidden_important" );
 				$( "#bank_label" ).removeClass( "hidden_important" );
 				$( "#card_label" ).removeClass( "hidden_important" );
 				$( "#pay_aparat_id" ).addClass( "hidden_important" );
	 			$( "#pey_label" ).addClass( "hidden_important" );
	 		}
	 		
    });	
	  $(document).on("change", "#category_id",function(){
			var a5 = $("#category_id").val();

			
	 	if( a5 == 422){
	 			$( "#pay_aparat_id" ).addClass( "hidden_important" );
	 			$( "#pey_label" ).addClass( "hidden_important" );
	 		}
	 		else
	 		{
	 			$( "#pay_aparat_id" ).removeClass( "hidden_important" );
	 			$( "#pey_label" ).removeClass( "hidden_important" );
	 		}
 		if( a5 == 423 || a5 == 424){
	 			$( "#aaaa" ).addClass( "hidden_important" );
	 			$( "#c" ).addClass( "hidden_important" );
	 			$( "#bbbb" ).addClass( "hidden_important" );
	 			$( "#d" ).addClass( "hidden_important" );
	 			//$( "#pay_aparat_id_1" ).addClass( "hidden_important" );
	 			//$( "#pay_aparat_id" ).addClass( "hidden_important" );
	 			//$( "#pay_type_id" ).addClass( "hidden_important" );
	 			//$( "#pay_type_id_1" ).addClass( "hidden_important" );
	 		}else{
	 			$( "#aaaa" ).removeClass( "hidden_important" );
	 			$( "#c" ).removeClass( "hidden_important" );
	 			$( "#bbbb" ).removeClass( "hidden_important" );
	 			$( "#d" ).removeClass( "hidden_important" );
	 			//$( "#d" ).removeClass( "hidden_important" );
	 			//$( "#pay_aparat_id" ).removeClass( "hidden_important" );
	 			//$( "#pay_type_id" ).removeClass( "hidden_important" );
	 			//$( "#pay_type_id_1" ).removeClass( "hidden_important" );
	 		}
	 		
	 		
    });
	    $(document).on("keydown", "#personal_pin", function(event) {
            if (event.keyCode == $.ui.keyCode.ENTER) {

            	param 			= new Object();
    		 	param.act		= "get_add_info";
    		 	param.pin		= $("#personal_pin").val();

    	    	$.ajax({
    		        url: aJaxURL,
    			    data: param,
    		        success: function(data) {
    					if(typeof(data.error) != 'undefined'){
    						if(data.error != ''){
    							alert(data.error);
    						}else{
    							$("#additional_info").html(data.info);
    						}
    					}
    			    }
    		    });
                
                event.preventDefault();
            }
        });
//
	    $(document).on("keydown", "#personal_id", function(event) {
            if (event.keyCode == $.ui.keyCode.ENTER) {

            	param 					= new Object();
    		 	param.act				= "get_add_info1";
    		 	param.personal_id		= $("#personal_id").val();

    	    	$.ajax({
    		        url: aJaxURL,
    			    data: param,
    		        success: function(data) {
    					if(typeof(data.error) != 'undefined'){
    						if(data.error != ''){
    							alert(data.error);
    						}else{
    							$("#additional_info").html(data.info1);
    						}
    					}
    			    }
    		    });
                
                event.preventDefault();
            }
        });

	    function LoadDialogCalls(){
			var button = {
               		"save": {
               			text: "განახლება",
               			id: "refresh-dialog",
               			click: function () {
               			}
               		}
				};

			/* Dialog Form Selector Name, Buttons Array */
			GetDialogCalls('last_calls', 330, "auto", button);
			
	    }
    </script>
 <style type="text/css">
.reqves_hist td{
padding: 0 13px;
border: inset 1px #B4D2E2;
text-align: left;
  }	
.reqves_hist td:nth-child(4){
padding: 0 13px;
border-right: inset 1px rgba(0, 0, 0, 0);
text-align: left;
  }
  		
   
    </style>
</head>

<body>

<table style="width: 100%; margin: 1 0 0 100px; padding-top:25px; display: block; ">
		<tr>
			<td style="width: 70%;">
<div id="tabs" style="width: 99%; margin: 0 auto; min-height: 768px; margin-top: 25px;">
		<ul>
			<li><a href="#tab-0">დღეს</a></li>
			<li><a href="#tab-1">ყველა ზარი</a></li>
			<li><a href="#tab-2">გადაცემულია გასარკვევად</a></li>
			<li><a href="#tab-3">გარკვევის პროცესშია</a></li>
			<li><a href="#tab-4">მოგვარებულია</a></li>
			<li <?php echo $tab_checker; ?>><a href="#tab-5">გადასამოწმებებლი ზარები</a></li>
			<li><a href="#tab-6">სხვა წყარო</a></li>
		</ul>
		<div id="tab-0">
			<div id="container" style="width: 100%;">        	
		       <div id="dynamic">
		       <h2 align="center">ზარები</h2>
            	<div id="button_area">
        			<button id="add_button">დამატება</button>
        		</div>
        		<div id="button_area">
        			<button id="refresh">რეფრეში</button>
        		</div>
        		<div id="button_area" style="margin-left: 20px">
        			<button  value="შემომავალი" id="filter_dam_shem"style="width: 100px; color: #ffffff; border-radius:5px; height: 25px; background-color:#4997ab;border:0px;">შემომავალი</button>
        			<button  value="გადართული  " id="filter_transf_shem"style="width: 100px; color: #ffffff; border-radius:5px; height: 25px; background-color:#4980AF;border:0px;">გადართული</button>
        			<button  value="გამავალი" id="filter_dam_gam"style="width: 100px; color: #ffffff; border-radius:5px; height:25px; background-color:#ce8a14;border:0px;">გამავალი</button>
        			<button  value=" გადართული " id="filter_transf_gam"style="width: 100px; color: #ffffff; border-radius:5px; height: 25px; background-color:#CE5F14;border:0px;">გადართული</button>
        			<button  value="უპასუხო" 	id="filter_unansver" style="width: 100px; color: #ffffff; border-radius:5px; height: 25px; background-color:#d35454;border:0px;">უპასუხო</button>
        			<button  value="დაუმ.გამავ" id="filter_dau_gam"style="width: 100px; color: #ffffff; border-radius:5px; height: 25px; background-color:#a07ab3;border:0px;">დაუმ.გამავ</button>
        			<button  value="დაუმ.შემომავ" id="filter_dau_shem"style="width: 100px; color: #ffffff; border-radius:5px; height: 25px; background-color:#71b251;border:0px;">დაუმ.შემომავ</button>
        		</div>
        		
                <table class="display" id="example" style="width: 100%;">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 7%;" >№</th>
                            <th style="width:  11%;">თარიღი</th>
                            <th style="width:  6%">pin-კოდი</th>
                            <th style="width:  9%">პ/ნ</th>
                            <th style="width:  9%">ტელეფონი</th>
                            <th style="width:  13%">ქვე კატეგორ.</th>
                            <th style="width:  5%">თანხა</th>
                            <th style="width:  12%">პასუხისმგებელი პ.</th>
                            <th style="width:  13%">დავალ. გამცემი</th>
                            <th style="width:  12%">სტატუსი</th>
                            <th style="width:  5%">ს.დრო</th>
                            <th style="width:  10%">ქმედება</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" style=""/>
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="" class="search_init" style="width:30px;"></th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" style="width:110px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 50px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 75px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 40px;"/>
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:150px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 40px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 55px;" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            <div class="spacer">
	              </div>
	                </div>
	         </div>
	          </div>
		<div id="tab-1">
			<div id="container" style="width: 100%;">        	
		       <div id="dynamic">
		       <h2 align="center">ზარები</h2>
		       <div id="button_area" style="margin-top: 40px;">
		       		<div class="left" style="width: 110px;">
		          		<button id="refresh_button">რეფრეში</button>
		         	</div>
		         	<div id="button_area">
	        			<button value="შემომავალი" id="filter_dam_shem1"style="width: 90px; color: #ffffff; border-radius:5px; height: 25px; background-color:#4997ab;border:0px;">შემომავალი</button>
	        			<button  value="გადართული  " id="filter_transf_shem1"style="width: 90px; color: #ffffff; border-radius:5px; height: 25px; background-color:#4980AF;border:0px;">გადართული</button>
	        			<button value="გამავალი" 	id="filter_dam_gam1"style="width: 90px; color: #ffffff; border-radius:5px; height:25px; background-color:#ce8a14;border:0px;">გამავალი</button>
	        			<button  value=" გადართული " id="filter_transf_gam1"style="width: 90px; color: #ffffff; border-radius:5px; height: 25px; background-color:#CE5F14;border:0px;">გადართული</button>
	        			<button value="უპასუხო" 	id="filter_unansver1" style="width: 90px; color: #ffffff; border-radius:5px; height: 25px; background-color:#d35454;border:0px;">უპასუხო</button>
	        			<button value="დაუმ.გამავ" id="filter_dau_gam1"style="width: 90px; color: #ffffff; border-radius:5px; height: 25px; background-color:#a07ab3;border:0px;">დაუმ.გამავ</button>
	        			<button value="დაუმ.შემომავ" id="filter_dau_shem1"style="width: 90px; color: #ffffff; border-radius:5px; height: 25px; background-color:#71b251;border:0px;">დაუმ.შემომ</button>
        			</div>
            		<div class="left" style="width: 160px; margin-left: 15px;">
	            		<input style="width: 100px; margin-left: 0px; height: 18px;" type="text" value="<?php echo date('d/m/y')." 00:00";?>" name="search_start_my" id="search_start_my" class="inpt left"/>
	            	</div>
	            	<div class="left" style="">
	            		<input style="width: 100px; margin-left: -38px; height: 18px;" type="text" value="<?php echo  date('d/m/y')." 23:59"; ?>" name="search_end_my" id="search_end_my" class="inpt right" />
	            	</div>
            		<div class="right" style="">
	            		<button id="search_button_all" style="width: 90px; margin-left: 15px; height: 30px;">ფილტრი</button>
	            	</div>
            	</div>		
            	<table class="display" id="example1" style="width: 100%;">
                    <thead>
                        <tr id="datatable_header">
                             <th>ID</th>
                            <th style="width: 7%;" >№</th>
                            <th style="width:  11%;">თარიღი</th>
                            <th style="width:  6%">pin-კოდი</th>
                            <th style="width:  9%">პ/ნ</th>
                            <th style="width:  9%">ტელეფონი</th>
                            <th style="width:  13%">ქვე კატეგორ.</th>
                            <th style="width:  5%">თანხა</th>
                            <th style="width:  12%">პასუხისმგებელი პ.</th>
                            <th style="width:  13%">დავალ. გამცემი</th>
                            <th style="width:  12%">სტატუსი</th>
                            <th style="width:  5%">ს.დრო</th>
                            <th style="width:  10%">ქმედება</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" style=""/>
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="" class="search_init" style="width:30px;"></th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" style="width:110px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 50px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 75px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:120px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 40px;"/>
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:150px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 40px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 55px;" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            <div class="spacer">
	              </div>
	                </div>
	         </div>
	          </div>
	     
	          <div id="tab-2">
			<div id="container" style="width: 100%;">        	
		       <div id="dynamic">
		       <h2 align="center">შემომავალი ზარები</h2>
            	<table class="display" id="example2" style="width: 100%;">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 7%;" >№</th>
                            <th style="width:  11%;">თარიღი</th>
                            <th style="width:  7%">pin-კოდი</th>
                            <th style="width:  9%">პ/ნ</th>
                            <th style="width:  9%">ტელეფონი</th>
                            <th style="width:  13%">ქვე კატეგორ.</th>
                             <th style="width:  5%">თანხა</th>
                            <th style="width:  12%">პასუხისმგებელი პ.</th>
                            <th style="width:  13%">დავალ. გამცემი</th>
                            <th style="width:  13%">სტატუსი</th>
                            <th style="width:  5%">ს.დრო</th>
                            <th style="width:  8%">ქმედება</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" style=""/>
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="" class="search_init" style="width:30px;"></th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" style="width:110px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 50px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 75px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:120px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 40px;"/>
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:150px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 40px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 55px;" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            <div class="spacer">
	              </div>
	                </div>
	         </div>
	          </div>
	          <div id="tab-3">
			<div id="container" style="width: 100%;">        	
		       <div id="dynamic">
		       <h2 align="center">შემომავალი ზარები</h2>
            	<table class="display" id="example3" style="width: 100%;">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 7%;" >№</th>
                            <th style="width:  11%;">თარიღი</th>
                            <th style="width:  7%">pin-კოდი</th>
                            <th style="width:  9%">პ/ნ</th>
                            <th style="width:  9%">ტელეფონი</th>
                            <th style="width:  13%">ქვე კატეგორ.</th>
                             <th style="width:  5%">თანხა</th>
                            <th style="width:  12%">პასუხისმგებელი პ.</th>
                            <th style="width:  13%">დავალ. გამცემი</th>
                            <th style="width:  13%">სტატუსი</th>
                            <th style="width:  5%">ს.დრო</th>
                            <th style="width:  8%">ქმედება</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" style=""/>
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="" class="search_init" style="width:30px;"></th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" style="width:110px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 50px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 75px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:120px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 40px;"/>
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:150px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 40px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 55px;" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            <div class="spacer">
	              </div>
	                </div>
	         </div>
	          </div>
	          <div id="tab-4">
			<div id="container" style="width: 100%;">        	
		       <div id="dynamic">
		       <h2 align="center">შემომავალი ზარები</h2>
		       	 <div id="button_area" style="margin-top: 40px;">
		       	 	<div class="left" style="width: 130px;">
		          		<button id="refresh_button1">რეფრეში</button>
		         	</div>
		       		<div class="left" style="width: 160px;">
	            		<label for="search_start_my1" class="left" style="margin: 8px 0 0 0px;">დან-</label>
	            		<input style="width: 100px; margin-left: 5px; height: 18px;" type="text" value="<?php echo date('d/m/y')." 00:00";?>" name="search_start_my1" id="search_start_my1" class="inpt left"/>
	            	</div>
	            	<div class="left" style="">
	            		<label for="search_end_my1" class="left" style="margin: 8px 0 0 0px;">მდე-</label>
	            		<input style="width: 100px; margin-left: 5px; height: 18px;" type="text" value="<?php echo  date('d/m/y')." 23:59"; ?>" name="search_end_my1" id="search_end_my1" class="inpt left" />
            		</div>
            		<div class="right" style="">
	            		<button id="search_button_all1" style="width: 90px; margin-left: 15px; height: 30px;">ფილტრი</button>
	            	</div>
            	</div>
            	<table class="display" id="example4" style="width: 100%;">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 7%;" >№</th>
                            <th style="width:  11%;">თარიღი</th>
                            <th style="width:  7%">pin-კოდი</th>
                            <th style="width:  9%">პ/ნ</th>
                            <th style="width:  9%">ტელეფონი</th>
                            <th style="width:  13%">ქვე კატეგორ.</th>
                             <th style="width:  5%">თანხა</th>
                            <th style="width:  12%">პასუხისმგებელი პ.</th>
                            <th style="width:  13%">დავალ. გამცემი</th>
                            <th style="width:  13%">სტატუსი</th>
                            <th style="width:  5%">ს.დრო</th>
                            <th style="width:  8%">ქმედება</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" style=""/>
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="" class="search_init" style="width:30px;"></th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" style="width:110px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 50px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 75px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:120px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 40px;"/>
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:150px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 40px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 55px;" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            <div class="spacer">
	              </div>
	                </div>
	         </div>
	          </div>
	          
	          <div id="tab-5" >
			<div id="container" style="width: 100%;">        	
		       <div id="dynamic">
		       <h2 align="center">გადასამოწმებელი ზარები</h2>
		       <div id="button_area">
        			<button id="delete_button">წაშლა</button>
        		</div>
            	<table class="display" id="example555" style="width: 100%;">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 7%;" >№</th>
                            <th style="width:  11%;">თარიღი</th>
                            <th style="width:  7%">pin-კოდი</th>
                            <th style="width:  9%">პ/ნ</th>
                            <th style="width:  9%">ტელეფონი</th>
                            <th style="width:  13%">ქვე კატეგორ.</th>
                             <th style="width:  5%">თანხა</th>
                            <th style="width:  12%">პასუხისმგებელი პ.</th>
                            <th style="width:  13%">დავალ. გამცემი</th>
                            <th style="width:  13%">სტატუსი</th>
                            <th style="width:  5%">ს.დრო</th>
                            <th style="width:  8%">ქმედება</th>
                             <th class="check">#</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" style=""/>
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="" class="search_init" style="width:30px;"></th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" style="width:110px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 50px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 75px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:120px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 40px;"/>
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:150px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 40px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 55px;" />
                            </th>
                             <th>
								<input type="checkbox" name="check-all" id="check-all-in"/>
							</th>
                        </tr>
                    </thead>
                </table>
	            <div class="spacer">
	              </div>
	                </div>
	         </div>
	          </div>
	           <div id="tab-6" >
			<div id="container" style="width: 100%;">        	
		       <div id="dynamic">
		       <h2 align="center">სხვა წყარო</h2>
		      <div id="button_area" style="margin-top: 50px;">
		      		<div class="left" style="width: 130px;">
		          		<button id="refresh_button2">რეფრეში</button>
		         	</div>
            		<div class="left" style="width: 160px;">
	            		<label for="search_start_my" class="left" style="margin: 8px 0 0 0px;">დან-</label>
	            		<input style="width: 100px; margin-left: 5px; height: 18px;" value="<?php echo date('d/m/y')." 00:00";?>" type="text" name="search_start" id="search_start_my2" class="inpt left"/>
	            	</div>
	            	<div class="left" style="">
	            		<label for="search_end_my" class="left" style="margin: 8px 0 0 0px;">მდე-</label>
	            		<input style="width: 100px; margin-left: 5px; height: 18px;" value="<?php echo  date('d/m/y')." 23:59"; ?>" type="text" name="search_end" id="search_end_my2" class="inpt right" />
            		</div>
            		<div class="right" style="">
	            		<button id="search_button_all2" style="width: 90px; margin-left: 15px; height: 30px;">ფილტრი</button>
	            	</div>
            	</div>
            	<table class="display" id="example6" style="width: 100%;">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 7%;" >№</th>
                            <th style="width:  11%;">თარიღი</th>
                            <th style="width:  7%">pin-კოდი</th>
                            <th style="width:  9%">პ/ნ</th>
                            <th style="width:  9%">წყარო</th>
                            <th style="width:  13%">ქვე კატეგორ.</th>
                             <th style="width:  5%">თანხა</th>
                            <th style="width:  12%">პასუხისმგებელი პ.</th>
                            <th style="width:  13%">დავალ. გამცემი</th>
                            <th style="width:  15%">სტატუსი</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" style=""/>
                            </th>
                            <th>
                            	<input type="text" name="search_number" value="" class="search_init" style="width:30px;"></th>
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" style="width:110px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 50px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 75px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:120px;" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" style="width: 40px;"/>
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 120px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width:150px;" />
                            </th>
                        </tr>
                    </thead>
                </table>
	            <div class="spacer">
	              </div>
	                </div>
	         </div>
	          </div>
	      </div>
	       
	    <td style="width: 0px;">
		   &nbsp;
		</td>
		<td style="width: 30%;">
		   <div id="jq" style="width: 450px; position: fixed;"></div>
		  
		</td>
	</tr>
</table>

    <!-- jQuery Dialog -->
    <div  id="add-edit-form" class="form-dialog" title="შემომავალი ზარი">
	</div>

	<!-- jQuery Dialog -->
	<div id="last_calls" title="ბოლო ზარები">
	</div>
	
	<!-- jQuery Dialog -->
	<div id="audio_dialog" title="ჩანაწერი">
	</div>
	<!-- jQuery Dialog -->
	<div id="logout" title="ავტომატური გამოსვლა სისტემიდან">
	</div>
	<!-- jQuery Dialog -->
	<div id="numlock_dialog" title="დაბლოკვა">
	</div>
</body>
